package com.gouwudai.gobbs.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;

import com.litt.core.exception.BusiException;

public class MasterLoginVO implements Serializable {
	
    private Integer masterId;
    private String loginId;
    private String masterName;
    private Date lastLoginTime;
    private String lastLoginIp;
    private Integer mgId;
    
    private HashMap<Integer,String> permission = new HashMap<Integer,String>();	//权限列表
    
	public void addPermission(Integer permissionCode,String permissionName)
	{
		permission.put(permissionCode, permissionName);
	}
	
	public void removePermission(Integer permissionCode)
	{
		permission.remove(permissionCode);
	}
	
	/**
	 * 如果没有权限抛出错误
	 * @param permissionCode
	 * @return
	 * @throws BusiException
	 */
	public boolean hasPermission(Integer permissionCode) throws BusiException
	{
		if(permission.containsKey(permissionCode))
			return true;
		else
			throw new BusiException("您没有当前功能的权限");
	}
	
	/**
	 * 如果没有权限返回FALSE
	 * @param permissionCode
	 * @return
	 */
	public boolean withPermission(Integer permissionCode)
	{
		if(permission.containsKey(permissionCode))
			return true;
		else
			return false;
	}	

	public String getLastLoginIp() {
		return lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public String getLoginId() {
		return loginId;
	}

	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}

	public Integer getMasterId() {
		return masterId;
	}

	public void setMasterId(Integer masterId) {
		this.masterId = masterId;
	}

	public String getMasterName() {
		return masterName;
	}

	public void setMasterName(String masterName) {
		this.masterName = masterName;
	}

	public Integer getMgId() {
		return mgId;
	}

	public void setMgId(Integer mgId) {
		this.mgId = mgId;
	}
	
	
}
